package DataView;

import java.util.Vector;

import javax.swing.JOptionPane;

public class Sequence_Error {

		private Vector<String> lista; 
		
		public Sequence_Error()
		{
			this.lista = new Vector<String>();
		}
		
		@SuppressWarnings("unchecked")
		public Sequence_Error(Vector<String> l)
		{
			lista=(Vector<String>) l.clone();
		}

		public boolean isEmpty()
		{
			return lista.isEmpty();
		}
		
		public void add(String daAggiungere)
		{
			lista.add(daAggiungere);
		}
		
		
		public int size() 
		{
			return lista.size();
		}

		public String get(int i) 
		{
			return lista.elementAt(i);
		}

		public Vector<String> getAll()
		{
			return lista;
		}
		
		public void remove(String selected) 
		{
			if(lista.contains(selected))
				lista.remove(selected);
			
			else
			{
				JOptionPane.showMessageDialog(null,
						"Elemento non presente", "Error",
						JOptionPane.WARNING_MESSAGE);
				
			}
		}
		
		public Sequence_Error clone()
		{
			return new Sequence_Error(lista);
		}
		
		public String getDescription()
		{
			String testo = lista.size()+" errors!";
			for (String s : lista)
			{
				testo = testo + " \n "+s;
			}
			return testo;
		}
		
	}